package com.neuedu.dao.impl;

import java.util.List;
import java.util.Map;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.neuedu.dao.ClientDao;
import com.neuedu.dao.StockInDao;
import com.neuedu.model.StockIn;

//把dao接口实现类，交给spring进行管理
@Repository
public class StockInDaoImpl implements StockInDao {

	
	//代码层级的整合spring+mybatis
	@Autowired
	private SqlSessionTemplate sqlSessionTemplate;
	
	public void setSqlSessionTemplate(SqlSessionTemplate sqlSessionTemplate) {
		this.sqlSessionTemplate = sqlSessionTemplate;
	}

	@Override
	public int countStockIn() {
		return sqlSessionTemplate.getMapper(StockInDao.class).countStockIn();
	}

	@Override
	public List<StockIn> findAll(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return sqlSessionTemplate.getMapper(StockInDao.class).findAll(map);
	}

	@Override
	public int addStockIn(StockIn c) {
		// TODO Auto-generated method stub
		return sqlSessionTemplate.getMapper(StockInDao.class).addStockIn(c);
	}

	@Override
	public int updateStockIn(StockIn c) {
		// TODO Auto-generated method stub
		return sqlSessionTemplate.getMapper(StockInDao.class).updateStockIn(c);
	}

	@Override
	public int deleteStockIn(int id) {
		return sqlSessionTemplate.getMapper(StockInDao.class).deleteStockIn(id);
	}

}
